<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.qs.po.*"%>
<%@page import="com.qs.vo.*"%>
<%@page import="com.qs.enums.*"%>
<%@page import="com.qs.service.*"%>
<%@page import="com.infomanage.po.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
    request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    QsGtTestItem item = GeneralTechTestService.loadGeneralTechTest(request, response, out);
    int deptId = -1;
    int personId = -1;
    int trainee = -1;
    String traineeName = "";
    String deptname = "";
    String personname = "";
    String testDate = "";
    String testType = "";
    float lostScore = 0;
    float getScore = 0;
    if(item != null) {
    	QsGtTest bean = item.getBean();
		Department dept = item.getDept();
		Person person = item.getPerson();
		Person traineeBean = item.getTrainee();
		trainee = traineeBean.getPersonId();
		traineeName = traineeBean.getName();
	    deptId = bean.getDeptId();
	    deptname = dept.getPath();
	    personId = person.getPersonId();
	    personname = person.getName();
	    lostScore = item.getBean().getQsLostScore();
	    getScore = item.getBean().getQsGetScore();
	    testDate = item.getBean().getQsGttDate();
    } 
%>

<html>
<head>
	<title>架木棚操作</title>
	<link href="<%=request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/table.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/calendar.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/common.js"></script>
	<script type="text/javascript">
	 function init() {
		   if("" != "<%=itemId%>") { // 修改
		   	   form1.personId.value = "<%=personId%>";	
			   form1.personname.value = "<%=personname%>";	
		   	   form1.trainee.value = "<%=trainee%>";	
			   form1.traineeName.value = "<%=traineeName%>";	
			   form1.deptId.value = "<%=deptId%>";
			   form1.deptname.value = "<%=deptname%>";
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

		function validate(){
	   		if(form1.deptId.value == ""){
	   			alert("小队不能为空！");
	   			return true;
	   		}

	   		if(form1.qsGttDate.value == ""){
	   			alert("考核日期不能为空！");
	   			return true;
	   		}

	   		if(form1.trainee.value == ""){
	   			alert("参训人不能为空！");
	   			return true;
	   		}
	   		
	   		if(form1.personId.value == ""){
	   			alert("考核人不能为空！");
	   			return true;
	   		}

	   		if(isNaN(form1.qsLostScore.value)){
	   			alert("扣分项必须为数字！");
	   			return true;
	   		}
	   		
	   		if(isNaN(form1.qsGetScore.value)){
	   			alert("得分项必须为数字！");
	   			return true;
	   		}


	   		if(form1.qsLostScore.value == ""){
	   			alert("扣分不能为空！");
	   			return true;
	   		}
	   	    
	   		if(form1.qsGetScore.value == ""){
	   			alert("得分不能为空！");
	   			return true;
	   		}
	   		return false;
	   }
	   
	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="generaltest_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="qsGttType" value="<%=OperateType.JMP.value()%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>架木棚操作</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="30%">
					<col width="70%">
					<tr>
						<td class="field">
							小队
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/deptTree.jsp');" treeSelect="true">
								<input name="deptname" style="width: 100%;" readonly="readonly" 
								treeSelect="true"><input name="deptId"  type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							考核日期
						</td>
						<td>
							<input value= "<%=testDate %>" type="text" name="qsGttDate" style="width: 230px;cursor: hand;" id="time" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="<%=request.getContextPath() %>/img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time', 'y-mm-dd');">
						</td>

					</tr>
					<tr>
						<td  class="field">
							参训人
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/personTree.jsp');" treeSelect="true">
								<input name="traineeName"  style="width: 100%;" readonly="readonly" 
								treeSelect="true"><input name="trainee"  type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td  class="field">
							考核人
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/personTree.jsp');" treeSelect="true">
								<input name="personname"  style="width: 100%;" readonly="readonly" 
								treeSelect="true"><input name="personId"  type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							扣分
						</td>
						<td>
							<input value="<%=lostScore %>" name="qsLostScore" style="width: 100%;"/>
						</td>
					</tr>
					<tr>
						<td class="field">
							得分
						</td>
						<td>
							<input value="<%=getScore %>"  name="qsGetScore" style="width: 100%;"/>
						</td>
					</tr>
					<tr>
						<td class="field">
							满分
						</td>
						<td>
							10分
						</td>
					</tr>
					<tr style="height: 300px">
						<td class="field">
							标准要求
						</td>
						<td valign="top" colspan="2">
							a）结构牢固、亲口严密，无明显歪扭，叉角适当。<br/>
							b）棚距0.8 ～1米，两边棚距（以腰线位置量）相差不超过50mm，一架棚高，一架棚低或同一架棚的一端高一端低，相差均不得超过50mm，6块背板（两帮和棚顶各两块）楔子准备16块。<br/>
							c）棚腿必须做“马蹄”。<br>
							d）棚腿窝深度不得少于都200mm，工作完成之后，必须埋好与地面平，棚子前倾后仰不得超过100mm。<br/>
							e）棚腿大头向上，亲口间隙不得超过4mm，后穷间隙不得超过15mm，梁腿亲口不准砍，不准砸。<br/>
							f)棚子叉角范围180 ～250mm（从亲口处作一垂线1米处到棚腿的水平距离），同一架棚两叉角相差不得超过30mm，梁亲口深度不少于50mm，腿亲口深度不少于40mm，梁刷头必须盖满柱顶。（如腿径小于梁子直径，则两者中心应在一条直线上）。<br/>
							g)棚梁的两块背板压在梁头上，从梁头到背板外边缘距离不大于200mm，两帮各两块背板，从柱顶到第一块背板上边缘的距离应大于400mm、小于600mm，从巷道底板第二块背板下边缘的距离应大于400mm、小于600mm。<br/>
							h）一块背板钉两块楔子，楔子使用位置正确，不松动，不准同点打双楔。<br/>
							i）30min完成。<br/>

						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>